<?php 

$data = $_FILES;

var_dump($data);

if(empty($_FILES)){
	echo "上传失败";exit;
}

if ($data['liu']['size']>300000) {
	echo "不允许上传";exit;
}

$arr1=explode('/', $data['liu']['type']);

$type=end($arr1);

var_dump($type);

$arr=['jpg','png','gif','jpeg'];

if (!in_array($type, $arr)) {
	echo "文件不符合";exit;
}

if ($data['liu']['error']>0) {
	echo "文件出错".$data['liu']['error'];
}

is_dir('./img') ||  mkdir('./img');

$name = uniqid();

if(move_uploaded_file($data['liu']['tmp_name'],'./Img/'.$name.'.'.$type)){
	echo "上传成功";
}else{
	echo "上传失败,新重新上传";
}
header("Location:./ind.php");











 ?>